<%--
  Created by IntelliJ IDEA.
  User: lys
  Date: 2020/8/20
  Time: 19:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>分类信息</title>
    <link rel="stylesheet" type="text/css" href="css\list.css">
</head>
<script type="text/javascript">
    function doDelete(second_cid){
        var flag = confirm("是否确定删除？");
        if (flag){
            // location.href="management?second_cid="+second_cid;
            //表明点了确定,访问Servlet。在当前页上打开超链接management?method=cdelete
            location.href="management?method=cdelete&second_cid="+second_cid;
        }
    }
</script>
<body>
<div class="container">
    <fieldset>
        <legend>分类列表</legend>
        <div style="height: 40px">
            <a href="management?method=cshow_create" class="btn-button">新增</a>
        </div>
        <!-- 油画列表 -->
        <table cellspacing="0px">
            <thead>
            <tr style="width: 150px;">
                <th style="width: 100px">二级分类id</th>
                <th style="width: 150px;">二级分类名</th>
                <th style="width: 100px;">一级分类名</th>
                <th style="width: 100px">操作</th>
            </tr>
            </thead>
            <c:forEach items="${pageModel.pageData}" var="stu">
                <tr>
                    <td>${stu.second_cid}</td>
                    <td>${stu.second_cname}</td>
                    <td>${stu.first_cname}</td>
                    <td>
                        <a class="oplink"  href="management?method=cshow_update&second_cid=${stu.second_cid}">修改</a>
                        <a class="oplink" href="#"  onclick="doDelete(${stu.second_cid})">删除</a>
                    </td>
                </tr>
            </c:forEach>
        </table>
        <!-- 分页组件 -->
        <ul class="page">
            <li><a href="management?method=clist&p=1">首页</a></li>
            <li><a href="management?method=clist&p=${pageModel.hasPreviousPage?pageModel.page-1:1 }">上页</a></li>
            <c:forEach begin="1" end="${pageModel.totalPages }" var="pno" step="1">
                <li ${pno==pageModel.page?"class='active'":"" }>
                    <a href="management?method=clist&p=${pno }">${pno }</a>
                </li>
            </c:forEach >
            <li><a href="management?method=clist&p=${pageModel.hasNextPage?pageModel.page+1:pageModel.totalPages }">下页</a></li>
            <li><a href="management?method=clist&p=${pageModel.totalPages }">尾页</a></li>
        </ul>
    </fieldset>
</div>

</body>
</html>


